Some config beans in the domain.xml file have a list of allowed properties. For example and auth-realm supports several properties. Here is an example of how this looks in the domain.xml: <auth-realm classname="com.sun.enterprise.security.auth.realm.file.FileRealm" name="admin-realm"> <property name="file" value="${com.sun.aas.instanceRoot}/config/admin-keyfile"></property> <property name="jaas-context" value="fileRealm"></property> </auth-realm> The GlassFish configuration framework supports several annotations that are used to declare properties in the config bean. For example, the declaration for the properties used above in the AuthRealm config bean looks like this: import org.glassfish.api.admin.config.PropertiesDesc; import org.glassfish.api.admin.config.PropertyDesc; import org.jvnet.hk2.config.types.Property; import org.jvnet.hk2.config.types.PropertyBag; import org.jvnet.hk2.component.Injectable; public interface AuthRealm extends ConfigBeanProxy, Injectable, PropertyBag { ... @PropertiesDesc( props={ @PropertyDesc(name="jaas-context", description="jaas-context. Specifies the JAAS (Java Authentication and Authorization Service) context"), @PropertyDesc(name="file", defaultValue="${com.sun.aas.instanceRoot}/config/keyfile", description="file realm. Specifies the file that stores user names, passwords, and group names."), } ) @Element List<Property> getProperty(); ... } The @PropertiesDesc annotation provides a container for properties, since an annotation can only be specified once within a class. The only argument for this annotation is "props" which is a list of @PropertyDesc annotations. The @PropertyDesc annotation provides the meta data for a single property. The arguments for this annotation are as follows: name - the name of the property description - a description for the property defaultValue - a default value for the property dataType - the date type for the property. The default value is String.class. This can be any class that extends DataType or one of the base types such as String.class, Integer.class, etc. values - a list of possible values for the property. The @Element annotation declares the properties as an element within the domain.xml. The List<Property> getProperty declaration declares the accessor method for the properties. There is no need to declare a setProperty method as this is automatically provided by the framework. |